import React, { createRef, MouseEventHandler, useRef, useState } from "react";
import ForwardModal from "../lookfoward/FowardModal";
import ReceivePropsC from "./components/ReciveProps";
/**  */
const TestProps = () => {
  const [state, setState] = useState<number>(0);

  const ref = createRef<any>();

  let a: number = 0;

  const handle = (e: any) => {
    console.log(e.target.dataset.param, ref.current.dataset);
  };

  return (
    <div>
      <button
        onClick={() => {
          setState(state + 1);
          a++;
        }}
      >
        add
      </button>
      <ReceivePropsC
        data={{
          title: state,
          a,
        }}
      />

      <button
        onClick={() => {
          ForwardModal.turnOn();
        }}
      >
        打开lookfoward
      </button>
      <button
        ref={ref}
        data-param={JSON.stringify({ key: "123", name: "fengzhilun" })}
        onClick={handle}
      >
        data-set
      </button>
    </div>
  );
};

export default TestProps;
